import 'package:flutter/material.dart';

void showMyDialog(
  BuildContext context,
  Widget child, {
  AlignmentGeometry alignment = Alignment.bottomCenter,
}) {
  showGeneralDialog(
    context: context,
    barrierDismissible: true,
    pageBuilder: (BuildContext context, Animation animation,
        Animation secondaryAnimation) {
      return FullScreenDialog(
        child: child,
        alignment: alignment,
      );
    },
    barrierColor: Colors.black26,
    barrierLabel: "",
    transitionDuration: Duration(
      milliseconds: 500,
    ),
  );
}

class FullScreenDialog extends StatefulWidget {
  final Widget child;
  final AlignmentGeometry alignment;
  const FullScreenDialog({
    Key key,
    this.child,
    this.alignment,
  }) : super(key: key);
  @override
  _FullScreenDialogState createState() => _FullScreenDialogState();
}

class _FullScreenDialogState extends State<FullScreenDialog> {
  @override
  Widget build(BuildContext context) {
    return Align(
      alignment: widget.alignment,
      child: widget.child,
    );
  }
}
